package com.dianxin.smartpark.web.visitor;

import java.util.List;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.visitor.SmartParkStrategyConfigQO;
import com.dianxin.smartpark.service.visitor.SmartParkStrategyConfigService;
import com.dianxin.smartpark.service.vo.visitor.SmartParkStrategyConfigVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 访客策略配置
 * 
 * @author chenjiasong
 * @date 2021-07-15
 */
@RestController
@RequestMapping("/smartpark/visitor/config")
public class  SmartParkStrategyConfigController
{
    @Autowired
    private SmartParkStrategyConfigService smartParkStrategyConfigService;

    /**
     * 查询访客策略配置列表
     */
    @GetMapping("/list")
    @SaCheckPermission(value = "/smartpark/visitor/config/list")
    public CommonResponseBody<List<SmartParkStrategyConfigVO>> list(SmartParkStrategyConfigQO qo)
    {
        return smartParkStrategyConfigService.selectSmartParkStrategyConfigList(qo);
    }

    /**
     * 获取访客策略配置详细信息
     */
    @GetMapping(value = "/getInfo")
    @SaCheckPermission(value = "/smartpark/visitor/config/getInfo")
    public CommonResponseBody<SmartParkStrategyConfigVO> getInfo(SmartParkStrategyConfigQO qo)
    {
        return smartParkStrategyConfigService.selectSmartParkStrategyConfig(qo);
    }

    /**
     * 新增访客策略配置
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/visitor/config/add")
    public CommonResponseBody<Boolean> add(@RequestBody SmartParkStrategyConfigVO vo)
    {
        return smartParkStrategyConfigService.insertSmartParkStrategyConfig(vo);
    }

    /**
     * 修改访客策略配置
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/visitor/config/edit")
    @RecordLog(name = "修改访客配置")
    public CommonResponseBody<Boolean> edit(@RequestBody SmartParkStrategyConfigVO smartParkStrategyConfig)
    {
        return smartParkStrategyConfigService.updateSmartParkStrategyConfig(smartParkStrategyConfig);
    }

    /**
     * 删除访客策略配置
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/visitor/config/remove")
    public CommonResponseBody<Boolean> remove(@RequestBody SmartParkStrategyConfigVO smartParkStrategyConfig)
    {
        return smartParkStrategyConfigService.deleteSmartParkStrategyConfig(smartParkStrategyConfig);
    }
}
